package request

import (
	"github.com/astaxie/beego/validation"
)

type SysRoleRequest struct {
	RoleId   uint             `json:"roleId"`                      //角色id
	RoleName string           `json:"roleName" binding:"required"` //角色名称
	MenuIds  []uint           `json:"menuIds"`                     //授权菜单列表ID
	Remark   string           `json:"remark"`                      //描述
}

func (r *SysRoleRequest) Valid(v *validation.Validation) {
	if r.RoleName == "" {
		v.SetError("RoleName", "角色名称不能为空")
	}
	//else if len(r.MenuIdList) == 0 {
	//	v.SetError("MenuIdList", "授权菜单列表不能为空")
	//}
}

type SysRoleDeleteRequest struct {
	RoleIds []uint `json:"roleIds"`
}

func (r *SysRoleDeleteRequest) Valid(v *validation.Validation) {
	if len(r.RoleIds) == 0 {
		v.SetError("RoleIds", "请选择需要删除的角色")
	}
}
